package com.beacon.controller;

import com.beacon.model.Loan;
import com.beacon.service.LoanService;
import com.beacon.service.LoanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.management.relation.Role;
import java.util.List;

/**
 * 编写者：冯庆虎
 * 编写时间：2019/05/21
 *
 */
@RestController(value = "/ Loan")//value值与数据库名称一致
public class LoanController {
    @Autowired
    private LoanService loanService;

    @RequestMapping(value = "/get Loan")//value值为/get+数据库全名
    public String setDataStr(String str){
        return "你输入的名字叫："+str;
    }

    /*跨域访问*/
    @CrossOrigin

    @RequestMapping(value = "/getL")//value值为/get+(数据库首字母)
    public  Loan getL(Integer lid){
        System.out.println("输入的数据为："+lid);
        return loanService.selectByPrimaryKey(lid);
    }

    //public void getLog(Loan loan){
       // if(loan != null){
         //   loanService.selectByPrimaryKey(loan.getLid());
        //}
    //}
    @RequestMapping(value = "getIsBegin")
    public List<Loan> getIsBegin(){
        System.out.println("调用角色全部类型的接口");
        List<Loan> listLoan = loanService.getIsBegin();
        return listLoan;
    }

}